package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppTradeOrder;
import com.ep.modules.app.service.AppTradeOrderService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/trade_order")
public class AppTradeOrderController {
    @Autowired
    private AppTradeOrderService appTradeOrderService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appTradeOrderService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppTradeOrder apptradeorder = appTradeOrderService.getById(id);
        return R.ok().put("apptradeorder", apptradeorder);
    }

    @SysLog("保存AppTradeOrder")
    @PostMapping("/save")
    public R save(@RequestBody AppTradeOrder apptradeorder) {
        ValidatorUtils.validateEntity(apptradeorder);
        appTradeOrderService.save(apptradeorder);
        return R.ok();
    }

    @SysLog("修改AppTradeOrder")
    @PostMapping("/update")
    public R update(@RequestBody AppTradeOrder apptradeorder) {
        ValidatorUtils.validateEntity(apptradeorder);
        appTradeOrderService.update(apptradeorder);
        return R.ok();
    }

    @SysLog("删除AppTradeOrder")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appTradeOrderService.deleteBatch(ids);
        return R.ok();
    }
}